﻿@using MVCMongo.Services
@model IEnumerable<DataMongo.Entities.FriendList>
@{
    ViewBag.Title = "FriendList";
    var imageUrl = "";
}

<div class="box box-color box-bordered box-small">
    <div class="box-title">
        <h3><i class="icon-user"></i>Friend List</h3>
        <div class="actions">
            <a class="btn btn-mini " href="@Url.Action("FriendInvite")"><i class="icon-plus"></i></a>

            <a class="btn btn-mini content-slideUp" href="#"><i class="icon-angle-down"></i></a>
        </div>
    </div>
    <div class="box-content">
        <table class="table table-user table-nohead">
            <tbody>
                @foreach (var item in Model)
                {
                   
                    <tr>
                        @if (item.FriendId == WebSecurity.CurrentUserId)
                        {
                            <td class="img">
                                @{
                                    imageUrl = UtilityService.GetCurrentUserImage(item.MyId);
                                }
                                @if (!string.IsNullOrEmpty(imageUrl))
                                {
                                    <img src="/content/UserProfile/User/@imageUrl" alt="" />
                                }
                                else
                                {

                                    <img src="~/Content/UserProfile/img/NoImage.jpg" />
                                }


                            </td>
                            <td class="user">
                            
                              
                                <a href="@Url.Action("UserFriendProfile", new { friendId = item.MyId })">
                                    @UtilityService.GetCurrentUserFullName(item.MyId)
                                </a>  
                            </td>
                        }
                        else
                        {
                             <td class="img">
                            @{
                             imageUrl = UtilityService.GetCurrentUserImage(item.FriendId);
                            }
                            @if (!string.IsNullOrEmpty(imageUrl))
                            {
                                <img src="/content/UserProfile/User/@imageUrl" alt="" />
                            }
                            else
                            {

                                <img src="~/Content/UserProfile/img/NoImage.jpg" />
                            }


                        </td>
                        <td class="user">
                            <a href="@Url.Action("UserFriendProfile", new {friendId=item.FriendId})">@UtilityService.GetCurrentUserFullName(item.FriendId)
                            </a>  
                         
                        </td>
                        }
                       

                    </tr>
                }
                <tr>
                    <td align="center" colspan="2">
                        <a class="btn btn-block btn-text-left" href="@Url.Action("FriendListAll")">See all</a>
                    </td>
                </tr>
        </table>

    </div>
</div> 